package behaviour.iterator;

/**
 * 迭代器模式
 * 顺序访问集合对象的元素而不需要知道集合对象的底层实现
 *
 * @author yeyangtao created at 2020/7/7 10:33
 */
public class IteratorDemo {
    public static void main(String[] args) {
        NameRepository nameRepository = new NameRepository();
        Iterator it = nameRepository.getIterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
    }
}
